/***************************************************************************
 *   Copyright (C) 2009 by Zheng Yonglei
 *   zhengyonglei@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef RECITEGREWORDS_H
#define RECITEGREWORDS_H

#include <iostream>

#include <QMainWindow>
#include <QCheckBox>
#include <QtGui/QWidget>
#include <QTimer>
#include <QTime>
#include <QComboBox>
#include <QShortcut>
#include <QMessageBox>
#include <QToolBar>
#include <QTimeEdit>
#include <QTranslator>
#include <QActionGroup>
#include <QGridLayout>

#include "ui_ReciteGREWords.h"

#include "SettingsDialog.h"
#include "TestResultAnalysisDialog.h"
#include "TestWidget.h"
#include "LinearBrowser.h"
#include "DictMaker.h"
#include "Trainer.h"

using namespace std;

class ReciteGREWords : public QMainWindow
{
    Q_OBJECT

public:
    ReciteGREWords(QWidget *parent = 0);
    ~ReciteGREWords();

private:
    Ui::ReciteGREWordsClass ui;

    QAction* mOpenListAct;
    QAction* mOpenAnalysisDialogAct;
    QAction* mResumeAct;
    QAction* mStartAct;
    QAction* mPauseAct;
    QAction* mFinishedCurTaskAct;
    QAction* mExitApp;
    QAction* mZoomIn;
    QAction* mZoomOut;
    QAction* mShowLoginDialog;
    QAction* mImportData;
    QAction* mExportData;
    QAction* mOpenDictMakerAct;
    QAction* mShowTrainer;

    QAction* mLanguageChinese;
    QAction* mLanguageEnglish;
    QActionGroup* mLanguageActionGroup;

    QTimeEdit* mTimeElapsedEditor;
    QTextEdit* mMainBulletin;

    TestWidget* mTestWidget;
    LinearBrowser* mLinearBrowser;
    Dictionary* mDictionary;

    Trainer mTrainer;

    QTimer mTaskTimer;
    QTime mTime;


public slots:
	//general
	void show();
	void languageChanged(QAction* action);

	//actions
	void showLoginDialog();
	void showSettingDialog();
	void showAboutThisApplication();
	void showSelectListDialog();
	void showAnalysisDialog();
	void showExportDataDialog();
	void showImportDataDialog();
	void showANN();
	void showDictMakerDialog();

	//main panel button slots
	void updateTimeElapsedDisplay();
	void updateMainBulletin();

	void pauseButtonPushed();
	void startButtonPushed();
	void spaceBarPressed();

	void finishCurTask();
	void exitApp();
	void resume();

	//select task dialog button slots
	bool startMemorizationTest();
	bool startWordBrowse();

	//zoom in/out display
	void zoomIn();
	void zoomOut();

private:
	void setProgramFont();

	void login();
	void logout();
	void dictMode();
};

#endif // RECITEGREWORDS_H
